Repository navigation
Conversation
Skirmish::SkirmishLeaderboard_DeleteEntry. Text from draft sourcehold#525 (reimpl/mission-skirmish-flow), with the style pass from REIMPLEMENTATION_STYLE_GUIDE.md. Measured on main 46f21c5 with a full build of the eight files of this PR and reccmp: 100.0 / 100.0. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
Skirmish::StoreGameIntoSKMasters. Text from draft sourcehold#525 (reimpl/mission-skirmish-flow), with the style pass from REIMPLEMENTATION_STYLE_GUIDE.md. Measured on main 46f21c5 with a full build of the eight files of this PR and reccmp: 100.0 / 100.0. The shift loop keeps `<= countof - 1`: with `< countof` MSVC compares against 250 with jge, the original against 249 with jg. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
… only the labels of two array[-1] addresses differ) Skirmish::Skirmish_PrepareLeaderboardView. Text from draft sourcehold#525 (reimpl/mission-skirmish-flow), with the style pass from REIMPLEMENTATION_STYLE_GUIDE.md. Measured on main 46f21c5 with a full build of the eight files of this PR and reccmp: 99.1 / 97.6. The only differences are the symbol names reccmp gives two addresses just before an array (INT_ARRAY_00eb0e48 and INT_ARRAY_00ed2be0 indexed from -1): I<char>::instance and I<int>::instance in the original, a resolver instance and a resolver initializer in ours. Instructions, operands and offsets are the same. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
Game::Tutorial_IsActionAllowed. Text from draft sourcehold#525 (reimpl/mission-skirmish-flow), with the style pass from REIMPLEMENTATION_STYLE_GUIDE.md. Measured on main 46f21c5 with a full build of the eight files of this PR and reccmp: 100.0 / 100.0. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
MapPropertiesState::adjustEventMonthAndYearForSection1047. Text from draft sourcehold#525 (reimpl/mission-skirmish-flow), with the style pass from REIMPLEMENTATION_STYLE_GUIDE.md. Measured on main 46f21c5 with a full build of the eight files of this PR and reccmp: 100.0 / 100.0. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
MapPropertiesState::loadMapSiegeHeaderForMissionIndex. Text from draft sourcehold#525 (reimpl/mission-skirmish-flow), with the style pass from REIMPLEMENTATION_STYLE_GUIDE.md. Measured on main 46f21c5 with a full build of the eight files of this PR and reccmp: 87.0 / 100.0. The raw difference is only the relative offsets of the four tail jumps to loadMapSiegeHeaderSections (0x004C3110). The header declares the mission number as char*; the file keeps that type and says so in a fixme. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
MapPropertiesState::loadMissionMapAndSetLord. Text from draft sourcehold#525 (reimpl/mission-skirmish-flow), with the style pass from REIMPLEMENTATION_STYLE_GUIDE.md. Measured on main 46f21c5 with a full build of the eight files of this PR and reccmp: 100.0 / 100.0. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
Synchrony::LoadSkirmishCampaignData. Text from draft sourcehold#525 (reimpl/mission-skirmish-flow), with the style pass from REIMPLEMENTATION_STYLE_GUIDE.md. Measured on main 46f21c5 with a full build of the eight files of this PR and reccmp: 100.0 / 100.0. The two string copies are strcpy, the clear of the player names uses sizeof, and the Ghidra locals are named. Three loops stay do-while: as for-loops MSVC compiles the slot reset to a different loop and unrolls the two team loops, which the original does not. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
|
Style guide reading (advisory, posted once) 3 possible deviation(s) from REIMPLEMENTATION_STYLE_GUIDE.md across 1 of the 8 reimplemented The match comes first. Where the ugly form is what matched, it stays -- that is the guide's own overriding rule, and rule 21 asks for a one-line comment saying what was measured so the next reader does not retry it. This report is posted once, when the PR opens, and is not repeated on later pushes.
WhereRule 9 — Prefer
|
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
SkirmishLobbySetupStructure::restoreSkirmishLobbySetup. Text from draft sourcehold#525 (reimpl/mission-skirmish-flow), with the style pass from REIMPLEMENTATION_STYLE_GUIDE.md. Measured on main 592a17d with a full build of the ten files of this PR (plus IO/ResourceManager/paths.cpp as a callee for the link) and reccmp: 99.3 / 95.2. The only difference is the operand order of one byte store, mov byte ptr [eax + esi], dl in the original against [esi + eax] in ours: the same address, so no change in behaviour. The two unrolled copy loops are for-loops with countof; MSVC unrolls them as the original. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
MenuTextInputState::loadOrSaveGame. Text from draft sourcehold#525 (reimpl/mission-skirmish-flow), with the style pass from REIMPLEMENTATION_STYLE_GUIDE.md. Measured on main 592a17d with a full build of the ten files of this PR (plus IO/ResourceManager/paths.cpp as a callee for the link) and reccmp: 93.1 / 93.5. The original keeps the constant 16 in ebp and uses it for both std::string capacity checks and the fileListVisibleRowCount store; ours uses the immediate each time. The rest follows from that: the longer immediate encodings shift the relative jump offsets, the loop's alignment filler is a jmp over padding instead of lea esp, [esp], and the call and handler targets differ only as labels. No change in behaviour. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
The filter of the skirmish rankings (DAT_00ed3124 while the rankings are open). The values follow the buttons that set them in MenuItemActionHandler_RankingGames_Main: 1 is "Crusader Trail Only", 2 is "Custom Games Only", 0 is "All Games". Used by Skirmish_PrepareLeaderboardView. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
The sort column of the skirmish rankings (MissionDefinedData.sortColumn). Skirmish_PrepareLeaderboardView sorts column 2 by mission, 3 by game duration and 4 by date. Columns 0 and 1 both keep the stored order (by score), so they stay unknown for now. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
The action type that Tutorial_IsActionAllowed checks. Its callers on main pass 1 when a building is selected in the toolbar (with the building type), 3 when the rations change and 4 when the taxes change. 2 also takes a building type, but none of its callers is reimplemented yet. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
- Enum values instead of numbers: LeaderboardFilter and LeaderboardSortColumn in Skirmish_PrepareLeaderboardView, TutorialActionType and BuildingType in Tutorial_IsActionAllowed, MenuModalType (MMT_LOAD_MAP / MMT_SAVE_MAP) for loadOrSaveGame's action. - TRUE/FALSE for 0/1 fields, and descending == TRUE for the BOOLEnum. - countof bounds in LoadSkirmishCampaignData, and its narrowing casts are gone. - The (short) casts in adjustEventMonthAndYearForSection1047 are gone. - loadOrSaveGame: the save patterns come from string-macros.hpp with +=, and the queued command is (GameCommandType)50 instead of an OR of two unrelated values. - #pragma warning(disable : 4996) for strcpy at the top of the three files that use it. - Unused includes (INT_00ed2bdc, MSVC_SecurityCookie) removed. - The code comments that explained forms kept for the match are gone; the PR thread explains them now. A comment that restated the code is gone too, and so is a speculative fixme on mission 18. Re-measured with a full build and reccmp on main 592a17d: no score changes. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
|
Some forms in this PR are kept only because they give the match. For each one, this lists the readable form I measured and what it cost. All numbers are from a full build and reccmp on main 592a17d (raw / normalized). The matching forms are at the scores in the PR table. Kept for the match
Header-side issues, not changed here (the generated headers stay as they are)
No enum on main yet, values not confirmed
New enum headers in this PR: Casts kept after the cast pass. No cast in this PR could go without changing the code or the build. Kept:
|
LF_ is already the prefix of Map/LogicHelpers/Logic1Flags (LF_NONE). Renamed in the header and in Skirmish_PrepareLeaderboardView; quick_diff output is unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
…Filter / LeaderBoardSortColumn The type names now match their value prefixes: LBF_ for LeaderBoardFilter, and LBSC_ (unused on main) instead of LSC_ for LeaderBoardSortColumn. Files, generated path comments, the include and every use in Skirmish_PrepareLeaderboardView are renamed; quick_diff output is unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
…5-matched Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
This PR takes ten functions from draft #525 (
reimpl/mission-skirmish-flow):Their
.cppfiles come from the draft, with a style pass. The draft's other functions stay in #525.Measured on
origin/main:dword/intmismatch infindBestAttackTileByPathCost.cpplocally.IO/ResourceManager/paths.cppwas also in the list, as a callee needed for the link. It is not part of this PR.Skirmish::SkirmishLeaderboard_DeleteEntry100.0% | ReimplementedSkirmish::StoreGameIntoSKMasters100.0% | ReimplementedSkirmish::Skirmish_PrepareLeaderboardView100.0% | Reimplemented (counted: only the labels of two array[-1] addresses differ)Game::Tutorial_IsActionAllowed100.0% | ReimplementedMapPropertiesState::adjustEventMonthAndYearForSection1047100.0% | ReimplementedMapPropertiesState::loadMapSiegeHeaderForMissionIndex100.0% | ReimplementedMapPropertiesState::loadMissionMapAndSetLord100.0% | ReimplementedSynchrony::LoadSkirmishCampaignData100.0% | ReimplementedSkirmishLobbySetupStructure::restoreSkirmishLobbySetup99.3% | Register allocation differsMenuTextInputState::loadOrSaveGame93.1% | Register allocation differsSkirmish_PrepareLeaderboardView: the instructions, operands and offsets are the same as the original's. Two addresses just before an array differ only in the symbol name that reccmp gives them:INT_ARRAY_00eb0e48 - 4in the backwards loop;INT_ARRAY_00ed2be0 - 4in the date column.The original calls these
I<char>::instanceandI<int>::instance. Ours calls them a resolver instance and a resolver initializer.loadMapSiegeHeaderForMissionIndex: the raw difference is only the relative offsets of its four tail jumps toloadMapSiegeHeaderSections(0x004C3110).Register allocation only (no change in behaviour):
restoreSkirmishLobbySetup: the only difference is the operand order of one byte store. The original hasmov byte ptr [eax + esi], dland ours has[esi + eax], which is the same address.loadOrSaveGame: the original keeps the constant 16 inebp. It usesebpfor bothstd::stringcapacity checks and for thefileListVisibleRowCountstore; ours uses the immediate each time. The other differences follow from that:jmpover padding instead oflea esp, [esp];Left in #525: each of these functions has a difference that the rule does not allow.
ComputePlayerRankingcmp, which is instruction selection.spawnInvasionEventAttackWavecomputeMissionCompletionScoreSetupSkirmishModeloadMapprocessSingleplayerEventsStyle pass (from
REIMPLEMENTATION_STYLE_GUIDE.mdon main), done in the per-function commits:.func.hppis the first include, and unused includes and usings are gone.++/-=replace self-assignments, and hex literals are decimal.countof/sizeofreplace the literals 250, 249, 0x8ca and 80000.restoreSkirmishLobbySetup,forloops replace the 45 unrolled copies. MSVC unrolls them the same way as the original.strcpyreplaces the two hand-written copy loops.iVarN/pCVar9, and the old Ghidra comments are rewritten.Pre-review pass (the
review:commit):LeaderBoardFilter/LeaderBoardSortColumn,TutorialActionTypewithBuildingType, andMenuModalTypeforloadOrSaveGame's action.TRUE/FALSEreplace 0/1 on flag fields.countofgives the loop bounds inLoadSkirmishCampaignData, and its narrowing casts are gone.string-macros.hpp.strcpystarts with#pragma warning(disable : 4996).Some forms stay only because they give the match: the
<= countof - 1test, thedo-whileloops, the repeated branches and the signed cast. The PR comment lists what each readable form costs, and the header-side issues I left alone. Twofixme:comments stay in the code:loadMapSiegeHeaderForMissionIndex: the header declares the mission number aschar*, though it is anint.loadOrSaveGame: the original writesDAT_ArrayOfMapIndices2[i - 1], soi = 0writes one entry before the array.After the pass and clang-format, the full build and reccmp give the numbers in the table above.
Header changes: none. The three enum headers this PR used are on main now, identical, through 0701799 ("upstream ghidra changes"), and the branch merges it:
Game/Skirmish/Enums/LeaderBoardFilter.hpp:LBF_ALL_GAMES,LBF_CRUSADER_TRAIL_ONLY,LBF_CUSTOM_GAMES_ONLY, after the ranking buttons that set them.Game/Skirmish/Enums/LeaderBoardSortColumn.hpp:LBSC_UNKNOWN_0,LBSC_UNKNOWN_1,LBSC_MISSION,LBSC_DURATION,LBSC_DATE.Game/Enums/TutorialActionType.hpp:TAT_SELECT_BUILDING,TAT_UNKNOWN_2,TAT_CHANGE_RATIONS,TAT_CHANGE_TAXES, after the callers on main.GL / visibility entries: none needed. The draft's only cmake difference is the
setDestinationForUnitline that main has since removed in #547.Overlap with open PRs: none. No other open PR touches these ten files or their status lines.
There is one commit per function. Each adds the file and sets its status line. After those come the enum header commits, the
review:commit and the merges of main.Draft #525 stays open for its remaining functions.
🤖 Generated with Claude Code
https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp